/**
 * LuxViewController
 * @Chunning.Xu
 * 2011 Nov 22, 2011 4:52:54 PM
 **/
package com.lux.product.controllers
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class LuxViewController extends EventDispatcher
	{
		//START.
		
		public var view:Sprite;
		
		protected var self:LuxViewController;
		
		public function LuxViewController(view:Sprite)
		{
			this.view = view;
			linkVariables();
		}

		protected function linkVariables():void
		{
			for(var i:int = 0;i < view.numChildren;i++)
			{
				var subview:DisplayObject = view.getChildAt(i);
				initSubview(subview);
				try{
					this[subview.name] = subview;
				}catch(err:Error){}
			}
		}
		
		protected function initSubview(subview:DisplayObject):void
		{
			// need to be override.
		}
		
		public function switchView(data:Object,animated:Boolean):void
		{
			
		}
	
		
		//END
	}
}